package com.sec.android.app.myfiles.widget;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;

import com.sec.android.app.myfiles.MyFilesTestRunner;
import com.sec.android.app.myfiles.R;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;

/**
 * Created by jaebae on 2016-07-26.
 */
@RunWith(MyFilesTestRunner.class)
public class testRclExpansionHelper implements RclExpansionHelper.OnExpansionStatusListener {

    RclExpansionHelper mRclExpansionHelper;
    boolean mOnStart = false;
    boolean mOnProgress = false;
    boolean mOnFinish = false;
    boolean mOnClose = false;
    boolean mOnMaxHeightChanged = false;


    @Before
    public void setUp() throws Exception {
        Activity activity = Robolectric.buildActivity(Activity.class).create().get();
        View view = null;
        try {
            view = (View) LayoutInflater.from(activity).inflate(R.layout.folder_selector_bottom_sheet_layout, null);
        } catch (Exception e) {

        }

        mRclExpansionHelper = new RclExpansionHelper();

        mRclExpansionHelper.setActivity(activity);
        if (view != null) {
            mRclExpansionHelper.setRootView(view.findViewById(R.id.bottom_sheet));
        }
        mRclExpansionHelper.setExpansionStatusListener(this);
        mOnStart = false;
        mOnProgress = false;
        mOnFinish = false;
        mOnClose = false;
        mOnMaxHeightChanged = false;
    }


    @Test
    public void testInit() {
        Assert.assertNotNull(mRclExpansionHelper);
    }


    @Override
    public void onStart(boolean isExpanded) {
        mOnStart = true;
    }

    @Override
    public void onProgress(int progress) {
        mOnProgress = true;
    }

    @Override
    public void onFinish(boolean isExpanded) {
        mOnFinish = true;
    }

    @Override
    public void onClose() {
        mOnClose = true;
    }

    @Override
    public void onMaxHeightChanged(int maxHeight) {
        mOnMaxHeightChanged = true;
    }
}
